<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        .rectangle {
            position: relative;
            width: 200px;
            height: 200px;
            margin: 100px auto;
            /* transform: rotate3d(1,-1,0,50deg); */
            /* 让子元素保留3d不换之后的效果 不回到原来的形态 */
            transform-style: preserve-3d;
            animation: totate 8s linear 0s infinite forwards;
            
            /* 透视
               得在浏览器控制器里面修改
               默认在元素的中心 */
            perspective: 0px;

            /* 设置透视的观察角度 */
            /* perspective-origin: 0px 0px; */
        }
        .rectangle  div {
            width: 200px;
            height: 200px;
            position: absolute;
        }
       
        .front {
            background-color: red;
            opacity: .5;
            transform: translate3d(0,100px,100px) rotate3d(1,0,0,-90deg);
        }
        .behind {
            background-color: green;
            opacity: .5;
            transform: translate3d(0,-100px,100px) rotate3d(1,0,0,-90deg);
        }
        .top {
            background-color: blue;
            opacity: .5;
            transform: translateZ(200px);
        }
        .buttom {
            background-color: pink;
            opacity: .5;
        }
        .left { 
            background-color: orange;
            opacity: .5;
            transform: translate3d(-100px,0,100px) rotateY(90deg) rotateZ(-90deg);
        }
        .right {
            background-color: purple;
            opacity: .5;
            transform: translate3d(100px,0,100px)  rotateY(90deg) rotateZ(-90deg);
        }

        @keyframes totate {
            0% {
                transform: rotate3d(0,0,0,0deg);
            }
            100%{
                transform: rotate3d(1,1,1,360deg);
            }
        }
    </style>
</head>
<body>
    <div class="rectangle">
        <div class="top">top</div>
        <div class="bottom">bottom</div>
        <div class="left">left</div>
        <div class="right">right</div>
        <div class="front">front</div>
        <div class="behind">behind</div>
    </div>
    
</body>
</html>